﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Demo.Framework.MulticastDelegate
{
    class Program
    {
        delegate void del();
        static void Main(string[] args)
        {
            del a = new del(DoWork);
            del b = new del(DoMoreWork);

            del c = a + b;
            del d = c - b;

            del e = a - b;

            Console.WriteLine("Single Delegate : a");
            a.Invoke();
            Console.WriteLine("Single Delegate : b");
            b.Invoke();

            Console.WriteLine("Multicast Delegate : c = a + b");
            c.Invoke();

            Console.WriteLine("Multicast Delegate : d = c - b");
            d.Invoke();

            Console.WriteLine("Multicast Delegate : e = a - b");
            e();

            Console.Read();
        }

        static void DoWork()
        {
            Console.WriteLine("Do Work");
        }

        static void DoMoreWork()
        {
            Console.WriteLine("Do More Work");
        }

    }
}
